<?php
$this->_toolbar = array(
		'title'		=>	Yii::t('admin_widgets', 'Widgets Manager'),
		'buttons'	=>	array(
			CHtml::link(Yii::t('app','Delete'), "", array("id"=>"delete", "class"=>"button-s del", "onclick"=>"deleteAll('".Yii::app()->createUrl('/admin_widgets/widgets/delMulti')."','".Yii::t('app','Are you sure you want to delete item?')."')")),
				CHtml::link(Yii::t('app','Advanced Search'), "", array("id"=>"search", "class"=>"search-button button-s")),
		)
);

Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$.fn.yiiGridView.update('widgets-grid', {
		data: $(this).serialize()
	});
	return false;
});
");
?>

<div class="search-form">
<?php $this->renderPartial('_search', array(
	'model' => $model,
)); ?>
</div><!-- search-form -->

<?php $this->widget('ext.widgets.iGridView', array(
	'id' => 'widgets-grid',
	'dataProvider' => $model->search(),
	'filter' => $model,
	'columns' => array(
		array(
			'name'	=>	'id',
			'htmlOptions'	=>	array('width'=>'30', 'align'=>'center')
		),
		array(
			'type'	=>	'raw',
			'header'	=>'<div id="sl-row" onclick="checkAll(this.id)" status="1">Check</div>',
			'htmlOptions'	=>	array(
				'width'	=>	'50',
				'align'	=>	'center',
			),
			'value'	=>	'CHtml::checkBox("rad_ID[]", "", array("value"=>$data->id))'
		),
		array(
			'name'	=>	'title',
			'type'	=>'raw',
			'value'	=>	'CHtml::link($data->title, array("widgets/update","id"=>$data->id))',
		),
		'widget_name',
		array(
			'name' => 'show_title',
			'type'	=>	'raw',
			'value' => '($data->show_title == 0) ? CHtml::image(Yii::app()->theme->baseUrl."/images/icons/Draft.png","Not Show") : CHtml::image(Yii::app()->theme->baseUrl."/images/icons/Published.png","Show",array("width"=>"21"))',
			'filter' => array('0' => Yii::t('app', 'No'), '1' => Yii::t('app', 'Yes')),
			'htmlOptions'	=>	array('align'=>'center')			
		),
		array(
			'name'	=>	'ordering',
			'htmlOptions'	=>	array('align'=>'center', 'width'=>'30')
		),
		array(
			'name'	=>	'published',
			'type'	=>	'raw',
			'value'	=>	'($data->published == 0) ? CHtml::image(Yii::app()->theme->baseUrl."/images/icons/Draft.png","unpublished") : CHtml::image(Yii::app()->theme->baseUrl."/images/icons/Published.png","Published",array("width"=>"21"))',
			'filter' => array('0' => Yii::t('app', 'No'), '1' => Yii::t('app', 'Yes')),
			'htmlOptions'	=>	array('align'=>'center')
		),
		/*
		'position',
		'params',
		'created',
		'created_by',
		'modified',
		'modified_by',
		array(
					'name' => 'published',
					'value' => '($data->published === 0) ? Yii::t(\'app\', \'No\') : Yii::t(\'app\', \'Yes\')',
					'filter' => array('0' => Yii::t('app', 'No'), '1' => Yii::t('app', 'Yes')),
					),
		*/
		array(
			'class' => 'CButtonColumn',
		),
	),
)); ?>
